﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using CMS.PBDesk.Business.UserManager;
using CMS.PBDesk.Framework.Web;


namespace PBDesk.Web.CMS.pages.user
{
    /// <summary>
    /// Summary description for Logon
    /// </summary>
    public class Logon : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            HttpRequest Request = context.Request;
            HttpResponse Response = context.Response;

            if (!Request.IsAuthenticated)
            {
                LogonStatus status = LogonHelper.LogonGigyaUser(Request.QueryString);
                switch (status)
                {
                    case LogonStatus.NewUser:
                        {
                            CookieManager.WriteCookie(CookieHelper.COOKIE_GIGYA_INFO, Request.QueryString);
                            Response.Redirect("~/membership/NewUser.aspx");
                            break;
                        }
                    case LogonStatus.Failure:
                        {
                            break;
                        }
                }

            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}